﻿
CREATE VIEW [dbo].[fares_viewArticolProductie]
AS
SELECT     IDArticol, Denumire, COALESCE (Lungime * Latime / 1000000, 0) AS Suprafata, CodUnitate, COALESCE
                          ((SELECT     SUM(StocInitial + StocPrecedent + Intrari - Iesiri) AS Stoc
                              FROM         dbo.Stocuri AS s
                              WHERE     (a.IDArticol = IDArticol)), 0) AS StocCurent,IDCategorie
FROM         dbo.Articole AS a